#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
struct ListNode* xuan(struct ListNode* head) {
    struct ListNode* pcur = head;
    struct ListNode* newhead = NULL;
    while (pcur)
    {
        struct ListNode* next = pcur->next;
        pcur->next = newhead;
        newhead = pcur;
        pcur = next;
    }
    return newhead;
}
bool chkPalindrome(ListNode* A) {
    struct ListNode* slow = A;
    struct ListNode* fast = A;
    while (fast && fast->next) {
        slow = slow->next;
        fast = fast->next->next;
    }
    struct ListNode* mid = slow;
    struct ListNode* wei = xuan(mid);
    struct ListNode* pcur = A;
    while (pcur && wei) {
        if (pcur->val != wei->val)
            return false;
        pcur = pcur->next;
        wei = wei->next;
    }
    return true;
}